Re: accpet(3n) under SOlaris 2.4

Casper Dik (casper@fwi.uva.nl)
Wed, 25 Jan 1995 12:01:50 +0100

>i recently tried to install identd on my new Solaris 2.4 machine.. i have
>since found out it has a problem with accept(3n). now.. im not sure why it
>spits the dummy at it, but here is the truss dump, so that those with either
>the source or more knowledge than myself could explain why it is barfing..
>here below it starts right at the accept.. lines beginning with *** are from
>the source code..
>
>***             fd = accept(0, &sad, &sadlen);
>2428:   sigaction(SIGCLD, 0xEFFFFC50, 0xEFFFFD50)       = 0
>2428:   poll(0xEFFFDD90, 1, -1)                         = 1
>2428:   sigfillset(0xEF683BB0)                          = 0
>2428:   sigprocmask(SIG_SETMASK, 0xEFFFFC8C, 0xEFFFFCC0) = 0
>2428:   ioctl(0, I_STR, 0xEFFFFB10)                     = 0
>2428:   ioctl(0, I_GETSIG, 0xEFFFFB94)                  Err#22 EINVAL
>2428:   sigprocmask(SIG_SETMASK, 0xEFFFFCC0, 0xEFFFFC6C) = 0
>***            if (fd == -1)
>***                ERROR1("main: accept. errno = %d", errno);
>
>anyway... the ioctl(0,I_GETSIG,xxxxx) seems to be the problem.. fd 0 is a
>socket (which will probably make a difference), just a straight normal tcp
>listen socket with no options. so anyway there is the problem... if anyone
>has a fix or knows what the problem is, it would be appreciated.

There are several reasons why you can't run identd 2.4.x in daemon or
wait mode.

First, there's a general bug in indentd.  It uses a struct sockaddr
for accept, not a struct sockaddr_in.  But this really shouldn't
matter as both have the same size.  I did get EINVAL but after
chaging the type a no longer did.  I'll look into it a bit more.

Secondly, in Solaris 2.4, identd needs to use kvm_setproc()/kvm_nextproc().
Unfortunately, kvm_setproc() is broken, and you'll never see processes
started after kvm_open.  

I'm working on a fix that will either fix kvm_setproc() for identd
because it's cheaper or will put kvm_open in the child instead of the
parent.

So, identd under 2.4 will only run in nowait mode for now.

Casper